import React, { Component } from 'react'
import "./login.css"
import { connect } from "react-redux"
import { bindActionCreators } from "redux"
import { actions, getUser } from "../../store/modules/login"
class login extends Component {
    render() {
        let { user: { phone, password }, register: { changeUser,reqLogin },history } = this.props
        return (
            <div className="login">
                {/* <img src="" alt=""></img> */}
                <ul>
                    <li>手机号: <input type="text" value={phone} onChange={(e)=>changeUser("phone",e.target.value)}/></li>
                    <li>密 &nbsp; 码<input type="text" value={password} onChange={(e)=>changeUser("password",e.target.value)}/></li>
                </ul>
                <input type="button" value="登录" onClick={()=>reqLogin(history)}/>
            </div>
        )
    }
}
let mapStateToProps = (state) => ({
    user: getUser(state),
});
let mapDispatchToProps = (dispatch) => ({
    register: bindActionCreators(actions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(login)
